package MicronautTest.ioc;

import io.micronaut.runtime.context.scope.Refreshable;

import javax.annotation.PostConstruct;
import javax.inject.Singleton;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Logger;

@Refreshable
public class WeatherService {
    private Logger log = Logger.getLogger("WeatherService");
    private String forecast;

    public WeatherService() {
        log.info("WeatherService");
    }

    @PostConstruct
    public void init() {
        log.info("init");
        forecast = "Scattered Clouds " + System.currentTimeMillis();
    }

    public String latestForecast() {
        return forecast;
    }
}
